//
//  StrategyTableViewCell.m
//  NewNest
//
//  Created by hesiyao on 16/1/17.
//  Copyright © 2016年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "StrategyTableViewCell.h"

@implementation StrategyTableViewCell

- (void)dealloc
{
    [_titleLabel release];
    [_titleImg release];
    [_contentLabel release];
    [_styleLabel release];
    [_likeLabel release];
    [_commentLabel release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_titleLabel];
        _titleLabel.numberOfLines = 0;
//        _titleLabel.backgroundColor = [UIColor redColor];
        [_titleLabel release];
        
        self.titleImg = [[UIImageView alloc] init];
        [self.contentView addSubview:_titleImg];
//        _titleImg.contentMode = UIViewContentModeScaleAspectFill;
//        _titleImg.backgroundColor = [UIColor purpleColor];
        [_titleImg release];
        
        self.contentLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_contentLabel];
//        _contentLabel.backgroundColor = [UIColor blueColor];
        _contentLabel.font = [UIFont systemFontOfSize:12];
        _contentLabel.numberOfLines = 0;
        _contentLabel.textColor = [UIColor grayColor];
        [_contentLabel release];
        
        self.styleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_styleLabel];
//        _styleLabel.backgroundColor = [UIColor cyanColor];
        _styleLabel.textAlignment = NSTextAlignmentCenter;
        _styleLabel.font = [UIFont systemFontOfSize:13];
        _styleLabel.numberOfLines = 0;
        _styleLabel.textColor = [UIColor grayColor];
        [_styleLabel release];
        
        self.likeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_likeLabel];
//        _likeLabel.backgroundColor = [UIColor greenColor];
        _likeLabel.font = [UIFont systemFontOfSize:13];
        _likeLabel.textAlignment = NSTextAlignmentCenter;
        [_likeLabel release];
        
        self.commentLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_commentLabel];
//        _commentLabel.backgroundColor = [UIColor yellowColor];
        _commentLabel.font = [UIFont systemFontOfSize:13];
        _commentLabel.textAlignment = NSTextAlignmentCenter;
        [_commentLabel release];
        
        self.likeImg = [[UIImageView alloc] init];
        [self.contentView addSubview:_likeImg];
//        _likeImg.backgroundColor = [UIColor orangeColor];
        [_likeImg release];
        
        self.commentImg = [[UIImageView alloc] init];
        [self.contentView addSubview:_commentImg];
//        _commentImg.backgroundColor = [UIColor blackColor];
        [_commentImg release];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    self.titleLabel.frame = CGRectMake(20, 10, self.contentView.frame.size.width - 40, self.contentView.frame.size.height / 4);
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.titleImg.frame = CGRectMake(20, _titleLabel.frame.size.height + 20, (self.contentView.frame.size.width - 50) / 3, self.contentView.frame.size.height / 2.2);
    self.contentLabel.frame = CGRectMake(_titleImg.frame.size.width + 30, _titleImg.frame.origin.y, (self.contentView.frame.size.width - 50) / 3 * 2, _titleImg.frame.size.height / 3 * 2);
    self.styleLabel.frame = CGRectMake(self.contentView.frame.size.width / 3 * 2,  _titleImg.frame.origin.y + _titleImg.frame.size.height / 3 * 2 + 5, _contentLabel.frame.size.width / 2, _titleImg.frame.size.height / 3 - 5);
    self.likeImg.frame = CGRectMake(self.contentView.frame.size.width / 4, _styleLabel.frame.origin.y + _styleLabel.frame.size.height + 10, self.contentView.frame.size.height / 9, self.contentView.frame.size.height / 9);
    self.likeLabel.frame = CGRectMake(_likeImg.frame.origin.x + _likeImg.frame.size.width + 10, _likeImg.frame.origin.y, self.contentView.frame.size.width / 4 - _likeImg.frame.size.width , _likeImg.frame.size.height);
    self.commentImg.frame = CGRectMake(self.contentView.frame.size.width / 2, _likeImg.frame.origin.y, _likeImg.frame.size.width, _likeImg.frame.size.height);
    self.commentLabel.frame = CGRectMake(self.contentView.frame.size.width / 2 + _commentImg.frame.size.width + 10, _likeImg.frame.origin.y, _likeLabel.frame.size.width, _likeLabel.frame.size.height);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
